package comfour;

import comfour.util.BaseJdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

public class Demo1 {
    public static void main(String[] args) throws Exception {
        String sql="select  * from student";
        ResultSet resultSet = BaseJdbc.getBaseSelect(sql,new Object[1]);
        //3:处理返回结果集
        List<Studnet> studnetList = new ArrayList<>();
        while (resultSet.next()){ // 映射
            Studnet studnet = new Studnet();
            studnet.setId(resultSet.getInt("StudentNo"));
            studnet.setStuName(resultSet.getString("StudentName"));
            studnet.setPassword(resultSet.getString("LoginPwd"));
            studnetList.add(studnet);
        }
        for (Studnet studnet:studnetList) {
            System.out.println(studnet.getStuName());
        }
    }

}
